Skip to content

fix: support Jira REST API v3 (v2 fallback)#19

Merged
pchuri merged 2 commits intomainfrom
fix/jira-api-v3-fallback
Dec 31, 2025
Merged

fix: support Jira REST API v3 (v2 fallback)#19
pchuri merged 2 commits intomainfrom
fix/jira-api-v3-fallback

Conversation

@pchuri
Copy link
Copy Markdown
Owner

@pchuri pchuri commented Dec 31, 2025

Fixes #18.

  • Use Jira REST API v3 search endpoint (/rest/api/3/search/jql) by default
  • Auto-fallback to v2 endpoints when v3 is unavailable
  • Add apiVersion config key + JIRA_API_VERSION env var (auto|2|3)
  • Make issue URL formatting work for v2/v3

Tests: npm test

@pchuri pchuri requested a review from Copilot December 31, 2025 12:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for Jira REST API v3 with automatic fallback to v2. The implementation defaults to v3 endpoints (specifically /rest/api/3/search/jql for searches) and falls back to v2 when v3 is unavailable. A new apiVersion configuration option allows users to explicitly set the API version (auto, 2, or 3).

Key changes:

  • Dual client architecture with separate axios instances for v2 and v3 APIs
  • Smart fallback mechanism that switches versions when API endpoints return 404/410 errors
  • New apiVersion configuration via config file or JIRA_API_VERSION environment variable

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/jira-client.js Core client refactored to support dual v2/v3 clients with automatic fallback logic
lib/config.js Added apiVersion configuration field with validation and environment variable support
lib/utils.js Updated URL formatting to handle both v2 and v3 API paths using regex
tests/jira-client.test.js Updated all test mocks to use new clientV2/clientV3 structure and request method
README.md Added documentation for JIRA_API_VERSION environment variable
docs/API.md Updated API documentation to include apiVersion parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pchuri pchuri merged commit 0c1fe3d into main Dec 31, 2025
5 checks passed
@pchuri pchuri deleted the fix/jira-api-v3-fallback branch December 31, 2025 12:11
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]

2 participants